﻿using System;
using System.Collections.Generic;

using System.Web;
using BangleCMS.Model;
using BangleCMS.BLL;
using System.Data;


/// <summary>
/// 网站配置类
/// </summary>
public class WebConfig
{
    public WebConfig()
    {
    }

    //
    //TODO: 在此处添加构造函数逻辑
    //
    private string _websidename;
    private string _keywords;
    private string _description;
    private string _fooder1;
    private string _fooder2;
    /// <summary>
    /// 网站名称
    /// </summary>
    public string WebSideName
    {
        get
        {
            return _websidename;
        }
        set
        {
            _websidename = value;
        }
    }

    /// <summary>
    /// 网站关键字
    /// </summary>
    public string Keywords
    {
        get
        {
            return _keywords;
        }
        set
        {
            _keywords = value;
        }
    }

    /// <summary>
    /// 网站描述
    /// </summary>
    public string Description
    {
        get
        {
            return _description;
        }
        set
        {
            _description = value;
        }
    }

    /// <summary>
    /// 网站底部文字1
    /// </summary>
    public string Fooder1
    {
        get
        {
            return _fooder1;
        }
        set
        {
            _fooder1 = value;
        }
    }

    /// <summary>
    /// 网站底部文字2
    /// </summary>
    public string Fooder2
    {
        get
        {
            return _fooder2;
        }
        set
        {
            _fooder2 = value;
        }
    }

    public string GetConfigValue(string ConfigKey)
    {
        try
        {
            web_config model = new web_config();
            web_configBLL bll = new web_configBLL();

            try
            {
                model = bll.GetModel(ConfigKey);
            }
            catch (Exception ex)
            {
            }

            if (model == null)
            {
                return "";
            }
            else
            {
                return model.ConfigValue;
            }
        }
        catch (Exception ex)
        {
            return "";
        }
    }

    public DataTable GetLink()
    {
        DataTable dt = new DataTable();
        try
        {
            dt = new UtilityBLL().GetListByPage("t_link", "*", "Valid=1", "OrderNo", 0, 1, 20).Tables[0];
        }
        catch (Exception ex)
        {
        }
        return dt;
    }
}
